﻿#Include ../_lib/gdip/GdipStarter.ahk

#Include util.ahk


gw := 400, gh := 400
g := Gui('+AlwaysOnTop -Caption +ToolWindow +E0x00080000')
g.Show(Format('x{} y{}', (A_ScreenWidth - gw) // 2, (A_ScreenHeight - gh) // 2))


FrameShadow(g.Hwnd)       ; 添加窗口阴影
TransparentWin(3, g.Hwnd) ; 使窗口透明


hdc := CreateCompatibleDC()
hbm := CreateDIBSection(gw + 2 + 10, gh + 2)
obm := SelectObject(hdc, hbm)
Graph := Gdip_GraphicsFromHDC(hdc)
Gdip_SetSmoothingMode(Graph, 4)
Gdip_FontFamilyCreate('consolas')

; Draw
pBrush := Gdip_BrushCreateSolid('0x' '0affffff')
Gdip_FillRectangle(Graph, pBrush, 0, 0, gw + 11, gh + 1) ; bk
Gdip_DeleteBrush(pBrush)

Gdip_TextToGraphics(Graph, 'Example nya!', 'x0 y5 s20 Center c' 'ff00bebb', 'consolas', 400, 20)

pPen := Gdip_CreatePen('0x' 'ffd2d2d2', 1)
Gdip_DrawRectangle(Graph, pPen, 0, 0, gw + 11, gh + 1) ; border
Gdip_DeletePen(pPen)
; EndDraw

g.GetPos(&x, &y)
UpdateLayeredWindow(g.Hwnd, hdc, x, y, gw + 2 + 10, gh + 2)

SelectObject(hdc, obm)
DeleteObject(hbm)
DeleteDC(hdc)
Gdip_DeleteGraphics(Graph)